<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<script src="http://cdn.static.runoob.com/libs/angular.js/1.4.6/angular.min.js"></script> 
</head>
<body>

<p>尝试修改以下表单。</p>

<div ng-app="myApp" >
	<div ng-controller="myCtrl">
		名: <input type="text" ng-model="firstName"><br>
		姓: <input type="text" ng-model="lastName"><br>
		<br>
		姓名: {{firstName + " " + lastName}}
		<h1>来自rootScope的变量：{{ttt}}</h1>
	</div>
	<div ng-controller="myCtrl2">
	
		hello<h1>{{yyy}}</h1>
		
		hello<h1>{{firstName}}</h1>
		
		hello<h1 ng-bind="firstName"></h1>
		<h1>来自rootScope的变量：{{ttt}}</h1>
		<div ng-controller="myCtrl3">
			<h1>myCtrl3开始了</h1>
			<h1>来自父亲{{yyy}}</h1>
			hello<h1>{{firstName}}</h1>
			<h1>来自rootScope的变量：{{ttt}}</h1>
		</div>
	</div>
</div>

<script>
var app = angular.module('myApp', []);
app.controller('myCtrl', function($scope,$rootScope) {
    $scope.firstName= "myCtrlJohn";
    $scope.lastName= "Doe";
   
});
app.controller('myCtrl2', function($scope) {
    $scope.yyy= "张伟";
    $scope.firstName= "myCtrl2John2";
});
app.controller('myCtrl3', function($scope,$rootScope) {
    $scope.firstName= "John3";
    $rootScope.ttt="今天打球的人很多";
});
</script>

</body>
</html>